import { ref }         from "vue"
import { defineStore } from "pinia"

export const useUserStore = defineStore("user", () => {
    let token = ref("")
    let info  = ref({})
    
    function setToken(value){
        token.value = value
        localStorage.setItem("token", value)
    }
    
    function recoverToken(){
        token.value = localStorage.getItem("token")
    }
    
    function setInfo(value){
        info.value = value
    }
    
    return {
        token,
        info,
        
        setToken,
        recoverToken,
        setInfo,
    }
})
